const path = require('path');
const webpack = require('webpack');
const CleanWebpackPlugin = require('clean-webpack-plugin');

let entry = require('./webpack.common.js')();

module.exports = {
    entry,
    // watch: true,
    devtool: 'inline-source-map',
    resolve: {
        extensions: ['.js'],
        alias: {
            '@': path.join( __dirname, '/src/resource/js/'),
            '~': path.join( __dirname, '/src/resource/')
        }
    },
    plugins: [
        new CleanWebpackPlugin(['./src/static/js']),
        new webpack.optimize.CommonsChunkPlugin({
            name: 'js/vendor',
            children: true,
            async: true
        })
    ],
    output: {
        path: path.resolve( __dirname, 'src/static'),
        filename: 'js/[name].js',
        chunkFilename: 'js/[name].js',
        publicPath: '/'
    }
};